@extends('admin::layouts.master')
@section('content')
    <form action="{{route('postrole',$admin)}}" method="post">
        @csrf
        <div class="col-lg-12">
            <div class="card card-border-color card-border-color-warning">
                <div class="card-header">
                    <h2>
                        【 {{$admin['nickname']}} 】 ==>>>
                        添加角色
                    </h2>
                </div>
                <div class="card-body">
                    <div class="form-group row pt-1 pb-1">
                        <label class="col-12 col-sm-3 col-form-label text-sm-right">所有角色名称</label>
                        <div class="col-12 col-sm-8 col-lg-6 form-check mt-2">
                            @foreach($role as $v)
                                <label class="custom-control custom-checkbox custom-control-inline">
                                    {{--hasRole()方法在这里引用，是因为在Admin模型中面use了一下,所以才可以调用--}}
                                    <input type="checkbox" name="name[]" value="{{$v['name']}}" {{$admin->hasRole($v['name']) ? 'checked' : ''}} class="custom-control-input"><span class="custom-control-label">{{$v['title']}}</span>
                                </label>
                            @endforeach
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <p class="text-right">
                <button type="submit" class="btn btn-space btn-primary btn-xl">保存</button>
            </p>
        </div>
    </form>
    @endsection
